import request from "@/utils/system/request";

class BaseApi {
    constructor(entityName) {
        this.entityName = entityName
    }

    add(data: object) {
        return request({
            url: `/${this.entityName}`,
            method: 'post',
            data
        })
    }

    findAll(data: object) {
        return request({
            url: `/${this.entityName}/all`,
            method: 'post',
            data
        })
    }


    deleteById(id: number) {
        return request({
            url: `/${this.entityName}/${id}`,
            method: 'delete'
        })
    }
}

export default BaseApi